<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>Examples</title>
  <meta name='viewport' content='width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no' />
  <meta name="description" content="">
  <meta name="keywords" content="">
  <link href="" rel="stylesheet">
  <style>
    .wrap {
      display: flex;
      margin: 10px;
    }

    .text {
      flex: 1
    }
  </style>
</head>

<body>
  <div onclick="clickme()">点击我</div>
  <script>
    const clickme = () => {
      console.log("====");
      <!-- 通过参数传递 token -->
      const ws = new WebSocket("ws://192.168.141.1:8080/ws/msg?device=PC&token=eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjdhY2YyOTAyLTk3ZGYtNDBlYS1hZTE4LTM3MjgxYWI5ZjUxNyJ9.2ZObeV_nXlmTDRWJXCNS7LbIm3Mi160rxCYzvrWW6YtHujRjPvy2qub24X4yxt8cA34ou5mF-IBJDwR3CJTtDA");
      ws.onopen = (e) => {
        console.log("onopen");
        console.log(e);
      }
      ws.onmessage = (data) => {
        console.log(data.data);

      }
      ws.onerror = (e) => {
<!--      debugger-->
        console.log("onerror" + e);
        console.log(e);
      }
    }

  </script>
</body>

</html>